
import 'package:flutter/material.dart';
import '../model/home_model.dart';
import 'fwebview.dart';


class LocalNav extends StatelessWidget {
  final List<CommonModel> localNavList;
  const LocalNav({super.key,required this.localNavList});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: localNavList == null ? 0 : 64,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(6),
        color: Colors.white,
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: _items(context),
      ),
    );
  }

  List<Widget> _items(BuildContext context){
    if (localNavList == null){
      return [];
    }
    return localNavList!.map((e){
      return GestureDetector(
         onTap: (){
            Navigator.push(context,MaterialPageRoute(builder: (context) => FWebView(url: e.url,title: e.title,statusBarColor: e.statusBarColor,hideAppBar: e.hideAppBar,)));
         },
        child: Padding(
            padding: EdgeInsets.fromLTRB(7, 10, 7, 0),
          child: Column(
        children: [
        Image.network(
          e.icon!,
          width: 32,
          height: 32,
        ),
        Text(
          e.title!,
          style: TextStyle(fontSize: 12,),
        )
        ],
      ),
        ),
      );
    }).toList();
  }
}
